package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;

public class InventoryTest extends TestCase {

	private CoffeeMaker cm;
    private Inventory in;
    private Recipe r1;
    private Recipe r2;

    public void setUp() throws Exception {
        cm = new CoffeeMaker();
        in = cm.checkInventory();

        r1 = new Recipe();
        r1.setName("BlackCoffee");
        r1.setPrice(30);
        r1.setAmtCoffee(2);
        r1.setAmtMilk(1);
        r1.setAmtSugar(3);
        r1.setAmtChocolate(1);
        cm.addRecipe(r1);
        
        r2 = new Recipe();
        r2.setName("IceChocolateMilk");
        r2.setPrice(50);
        r2.setAmtCoffee(1);
        r2.setAmtMilk(2);
        r2.setAmtSugar(3);
        r2.setAmtChocolate(4);
        cm.addRecipe(r2);
}
    public void testSetMilk() 
    {
            in.setMilk(1);
            assertEquals(in.getMilk(),1);
    }
    
    public void testSetSugar1()
    {
            in.setSugar(-1);
            int Sugar = in.getSugar();
            assertFalse(Sugar < 0);
    }

    public void testSetCoffee() 
    {
            in.setCoffee(3);
            assertEquals(in.getCoffee(),3);
    }
    public void testSetCoffee_1() 
    {
            in.setCoffee(-3);
            assertEquals(in.getCoffee(),0);
    
}
    public void testEnoughIngredients_1() {
        
        in.setChocolate(3);
        Recipe r1 = new Recipe(); 
        r1.setAmtChocolate(4); 
        
        assertFalse( in.enoughIngredients(r1));
}
  public void testEnoughIngredients_2() {
        
        in.setMilk(3);
        Recipe r1 = new Recipe(); 
        r1.setAmtMilk(4); 
        
        assertFalse( in.enoughIngredients(r1));
}
  public void testEnoughIngredients_3() {
      
      in.setSugar(3);
      Recipe r1 = new Recipe(); 
      r1.setAmtSugar(4); 
      
      assertFalse( in.enoughIngredients(r1));
}
public void testEnoughIngredients_4() {
      
      in.setCoffee(3);
      Recipe r1 = new Recipe(); 
      r1.setAmtCoffee(4); 
      
      assertFalse( in.enoughIngredients(r1));
}
  
public void testString() {
    
	in.setMilk(5);
    in.setCoffee(5);
    in.setChocolate(5);
    in.setSugar(5);
   
    
    String check = "Coffee: 5" + "\n" +
                    "Milk: 5" + "\n" +
                    "Sugar: 5" + "\n" +
                    "Chocolate: 5" + "\n";
    
    assertEquals(check, in.toString());
    

}

}
